3.1.45 \(\int \frac {3+x^2}{-3+x^2} \, dx\) [45]

Optimal. Leaf size=17 \[ x-2 \sqrt {3} \tanh ^{-1}\left (\frac {x}{\sqrt {3}}\right ) \]

[Out]

x-2*arctanh(1/3*x*3^(1/2))*3^(1/2)

________________________________________________________________________________________

Rubi [A]
time = 0.00, antiderivative size = 17, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.154, Rules used = {396, 213} \begin {gather*} x-2 \sqrt {3} \tanh ^{-1}\left (\frac {x}{\sqrt {3}}\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(3 + x^2)/(-3 + x^2),x]

[Out]

x - 2*Sqrt[3]*ArcTanh[x/Sqrt[3]]

Rule 213

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[b, 2])^(-1))*ArcTanh[Rt[b, 2]*(x/Rt[-a, 2])]
, x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (LtQ[a, 0] || GtQ[b, 0])

Rule 396

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[d*x*((a + b*x^n)^(p + 1)/(b*(n*(
p + 1) + 1))), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(b*(n*(p + 1) + 1)), Int[(a + b*x^n)^p, x], x] /; FreeQ[{
a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && NeQ[n*(p + 1) + 1, 0]

Rubi steps

\begin {align*} \int \frac {3+x^2}{-3+x^2} \, dx &=x+6 \int \frac {1}{-3+x^2} \, dx\\ &=x-2 \sqrt {3} \tanh ^{-1}\left (\frac {x}{\sqrt {3}}\right )\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.01, size = 33, normalized size = 1.94 \begin {gather*} x+\sqrt {3} \log \left (\sqrt {3}-x\right )-\sqrt {3} \log \left (\sqrt {3}+x\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(3 + x^2)/(-3 + x^2),x]

[Out]

x + Sqrt[3]*Log[Sqrt[3] - x] - Sqrt[3]*Log[Sqrt[3] + x]

________________________________________________________________________________________

Maple [A]
time = 0.14, size = 15, normalized size = 0.88

method result size
default \(x -2 \arctanh \left (\frac {\sqrt {3}\, x}{3}\right ) \sqrt {3}\) \(15\)
risch \(x +\sqrt {3}\, \ln \left (x -\sqrt {3}\right )-\sqrt {3}\, \ln \left (x +\sqrt {3}\right )\) \(26\)
meijerg \(-\arctanh \left (\frac {\sqrt {3}\, x}{3}\right ) \sqrt {3}-\frac {i \sqrt {3}\, \left (\frac {2 i \sqrt {3}\, x}{3}-2 i \arctanh \left (\frac {\sqrt {3}\, x}{3}\right )\right )}{2}\) \(38\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((x^2+3)/(x^2-3),x,method=_RETURNVERBOSE)

[Out]

x-2*arctanh(1/3*3^(1/2)*x)*3^(1/2)

________________________________________________________________________________________

Maxima [A]
time = 0.51, size = 22, normalized size = 1.29 \begin {gather*} \sqrt {3} \log \left (\frac {x - \sqrt {3}}{x + \sqrt {3}}\right ) + x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x^2+3)/(x^2-3),x, algorithm="maxima")

[Out]

sqrt(3)*log((x - sqrt(3))/(x + sqrt(3))) + x

________________________________________________________________________________________

Fricas [A]
time = 3.29, size = 26, normalized size = 1.53 \begin {gather*} \sqrt {3} \log \left (\frac {x^{2} - 2 \, \sqrt {3} x + 3}{x^{2} - 3}\right ) + x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x^2+3)/(x^2-3),x, algorithm="fricas")

[Out]

sqrt(3)*log((x^2 - 2*sqrt(3)*x + 3)/(x^2 - 3)) + x

________________________________________________________________________________________

Sympy [A]
time = 0.02, size = 27, normalized size = 1.59 \begin {gather*} x + \sqrt {3} \log {\left (x - \sqrt {3} \right )} - \sqrt {3} \log {\left (x + \sqrt {3} \right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x**2+3)/(x**2-3),x)

[Out]

x + sqrt(3)*log(x - sqrt(3)) - sqrt(3)*log(x + sqrt(3))

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 30 vs. \(2 (14) = 28\).
time = 0.82, size = 30, normalized size = 1.76 \begin {gather*} \sqrt {3} \log \left (\frac {{\left | 2 \, x - 2 \, \sqrt {3} \right |}}{{\left | 2 \, x + 2 \, \sqrt {3} \right |}}\right ) + x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x^2+3)/(x^2-3),x, algorithm="giac")

[Out]

sqrt(3)*log(abs(2*x - 2*sqrt(3))/abs(2*x + 2*sqrt(3))) + x

________________________________________________________________________________________

Mupad [B]
time = 0.92, size = 14, normalized size = 0.82 \begin {gather*} x-2\,\sqrt {3}\,\mathrm {atanh}\left (\frac {\sqrt {3}\,x}{3}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((x^2 + 3)/(x^2 - 3),x)

[Out]

x - 2*3^(1/2)*atanh((3^(1/2)*x)/3)

________________________________________________________________________________________